package lesson.Properties;

import javax.swing.text.html.HTMLDocument;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class PropertiesDemo1 {
    public static void main(String[] args) {
        Properties prop = new Properties();

        //1.增
        prop.put("阿尔萨斯","吉安娜");
        prop.put("伊利丹","玛维");
        prop.put("格雷迈恩","安度因");
        System.out.println(prop);

        //2.删
        prop.remove("阿尔萨斯");
        System.out.println(prop);

        //3.改
        prop.put("伊利丹","恶魔");

        //4.查
        Object object = prop.get("伊利丹");
        System.out.println(object);
        System.out.println("---------------------------------");
        //遍历
        Set<Object> s1 = prop.keySet();
        for (Object o : s1) {
            Object o1 = prop.get(o);
            System.out.println(o+"..."+o1);
        }
        System.out.println("---------------------------------");
        Set<Map.Entry<Object, Object>> s2 = prop.entrySet();
        for (Map.Entry<Object, Object> o2 : s2) {
            System.out.println(o2.getKey()+"..."+o2.getValue());
        }
    }
}
